package com.haidong.dao.impl;

import com.haidong.dao.BookDao;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Repository("bookDao2")
public class BookDaoImpl2 implements BookDao {
    @Value("wangHaiDong")
    // value注解负责注入简单数据类型,在这里写还不如直接赋值,脱裤子放屁
    // 因为value注解主要靠读取配置文件获取
    private String name;

    @Value("${driverName}")
    private String driverName;

    @Override
    public void run() {
        System.out.println("注解bookDao2方法");
        System.out.println(name);
        System.out.println(driverName);
    }

    @PostConstruct
    public void init(){
        System.out.println("注解初始化bookDao2");
    }

    @PreDestroy
    public void destroy(){
        System.out.println("注解销毁bookDao2方法");
    }
}
